package com.guiji.text2video.system.api.factory;

import com.guiji.text2video.system.api.RemoteAIBaseService;
import com.guiji.text2video.system.api.domain.SysTts;
import feign.Response;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName RemoteAIBaseFallbackFactory
 * @Description TODO
 * @Author 钟维澎（四月）
 * @Date 2021/6/3 13:48
 * @Version 1.0
 */
@Component
public class RemoteAIBaseFallbackFactory implements FallbackFactory<RemoteAIBaseService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteAIBaseFallbackFactory.class);

    @Override
    public RemoteAIBaseService create(Throwable throwable) {
        log.error("AIBase服务调用失败:{}", throwable.getMessage());
        return new RemoteAIBaseService() {
            @Override
            public Response video(String video) {
                return null;
            }

            @Override
            public Response tts(SysTts sysTts) {
                return null;
            }
        };
    }
}
